from bs4 import BeautifulSoup
# soup = BeautifulSoup("<p>Some<b>bad<i>HTML",features='lxml')
# print(soup.prettify())


hxml_str = """
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<ul>
    <li id="li1">li1</li>
    <li id="li2">li2</li>
    <li id="li3">li3</li>
</ul>

<ol>
    <li id="li1"><a href="https://www.baidu.com">百度</a></li>
    <li id="li2"><a href="https://www.jd.com">京东</a></li>
    <li id="li3"><a href="https://www.taobao.com">淘宝</a></li>
</ol>

<h1><a href="https://www.pdd.com">拼多多</a></h1>
</body>
</html>"""

soup = BeautifulSoup(hxml_str,features='lxml')

title = soup.find('title').text
print(title,type(title))


